import xen.lowlevel.xc
-from xen.xend.xenstore.xsutil import IntroduceDomain
-
from XendError import XendError
from XendLogging import log
"""
return self.xendRequest(url, "POST", args)
- def handleStatus(self, version, status, message):
+ def handleStatus(self, _, status, message):
"""Handle the status returned from the request.
"""
status = int(status)
"""Handle the data returned in response to the request.
"""
if data is None: return None
- type = self.getHeader('Content-Type')
- if type != sxp.mime_type:
+ typ = self.getHeader('Content-Type')
+ if typ != sxp.mime_type:
return data
try:
pin = sxp.Parser()
path = xroot.get_xend_unix_path()
self.path = path
- def makeConnection(self, url):
+ def makeConnection(self, _):
return UnixConnection(self.path)
v = self.get_config_value(name, val)
try:
return int(v)
- except Exception, ex:
+ except Exception:
raise XendError("invalid xend config %s: expected int: %s" % (name, v))
def get_xend_http_server(self):
script = os.path.join(xroot.network_script_dir,
sxp.child_value(config, 'script',
xroot.get_vif_script()))
- type = sxp.child_value(config, 'type')
- if type == 'ioemu':
+ typ = sxp.child_value(config, 'type')
+ if typ == 'ioemu':
return (None,{},{})
bridge = sxp.child_value(config, 'bridge')
mac = sxp.child_value(config, 'mac')
# Copyright (C) 2005 XenSource Ltd
#============================================================================
-import socket
import sys
import StringIO
class test_sxp(unittest.TestCase):
def testAllFromString(self):
- def t(input, expected):
- self.assertEqual(xen.xend.sxp.all_from_string(input), expected)
+ def t(inp, expected):
+ self.assertEqual(xen.xend.sxp.all_from_string(inp), expected)
t('String', ['String'])
t('(String Thing)', [['String', 'Thing']])
import random
-def getUuidUuidgen(random = True):
+def getUuidUuidgen(randomly = True):
"""Generate a UUID using the command uuidgen.
- If random is true (default) generates a random uuid.
- If random is false generates a time-based uuid.
+ If randomly is true (default) generates a random uuid.
+ If randomly is false generates a time-based uuid.
"""
cmd = "uuidgen"
- if random:
+ if randomly:
cmd += " -r"
else:
cmd += " -t"
def getUuidRandom():
"""Generate a random UUID."""
- return [ random.randint(0, 255) for i in range(0, 16) ]
+ return [ random.randint(0, 255) for _ in range(0, 16) ]
#uuidFactory = getUuidUuidgen